home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PASCAL
/
1463.ZIP
/
DRAW-2D.ARC
/
ROTATES.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1986-12-03
|
4KB
|
122 lines
PROCEDURE ROTATES;
VAR
ANGLE,XREF,YREF:REAL;
FLAG:BOOLEAN;
KODE,K:INTEGER;
MSG:SCRLINE;
BEGIN
MOVCUR(24,2);
WRITE('Select Reference Point & press Left button (Right button for 0,0) >');
RING(1);
FLAG := FALSE;
WHILE NOT(FLAG) DO
BEGIN
GETMOUSE(X,Y,PIXX,PIXY,OPTION);
IF (BUTTON1) OR (BUTTON2) THEN FLAG := TRUE;
IF (BUTTON1) AND (OPTION <> 0) THEN
BEGIN
FLAG := FALSE;
RING2;
MOVCUR(24,1);
WRITE(BLKLINE);
MOVCUR(24,2);
WRITE('Move mouse cursor into graphics area!!');
END;
END;
IF BUTTON1 THEN
BEGIN
M1 := 2;
MOUSE(M1,M2,M3,M4); (* HIDE MOUSE *)
MARK(PIXX,PIXY,HRCOLOR);
M1 := 1; (* SHOW MOUSE *)
MOUSE(M1,M2,M3,M4);
XREF := X;
YREF := Y;
END
ELSE
BEGIN
XREF := 0.0;
YREF := 0.0;
END;
MSG := 'Enter Rotation Angle <0.0>: ';
ANGLE := ASKREAL(24,2,MSG,-360.0,360.0,0.0);
ANGLE := (ANGLE/360.0) * 2.0 * PI;
PUSHID(KODE);
TRANSLAT(-XREF,-YREF,KODE);
ROTATE(ANGLE,KODE);
TRANSLAT(XREF,YREF,KODE);
CASE MNUM OF
1: BEGIN (* ENTIRE DRAWING *)
FOR K := 1 TO OBJPTR-1 DO
WITH DRAWARY[K] DO
BEGIN
CASE OBJTYP OF
0: BEGIN END; (* DELETED OBJECT *)
1: MODVEC(X1,Y1,STKMAT[STKPTR-1]); (* POINT *)
2: BEGIN (* LINE *)
MODVEC(X1,Y1,STKMAT[STKPTR-1]);
MODVEC(X2,Y2,STKMAT[STKPTR-1]);
END;
3: BEGIN (* BOX *)
MODVEC(X1,Y1,STKMAT[STKPTR-1]);
MODVEC(X2,Y2,STKMAT[STKPTR-1]);
MODVEC(X3,Y3,STKMAT[STKPTR-1]);
END;
4: BEGIN
MODVEC(X1,Y1,STKMAT[STKPTR-1]); (* CIRCLE *)
END;
END; (* CASE *)
END; (*WITH*)
END;
2: BEGIN (* AREA *)
FOR K := 1 TO OBJPTR-1 DO
WITH DRAWARY[K] DO
BEGIN
IF OBJSEL = 1 THEN
CASE OBJTYP OF
0: BEGIN END; (* DELETED OBJECT *)
1: MODVEC(X1,Y1,STKMAT[STKPTR-1]); (* POINT *)
2: BEGIN (* LINE *)
MODVEC(X1,Y1,STKMAT[STKPTR-1]);
MODVEC(X2,Y2,STKMAT[STKPTR-1]);
END;
3: BEGIN (* BOX *)
MODVEC(X1,Y1,STKMAT[STKPTR-1]);
MODVEC(X2,Y2,STKMAT[STKPTR-1]);
MODVEC(X3,Y3,STKMAT[STKPTR-1]);
END;
4: BEGIN
MODVEC(X1,Y1,STKMAT[STKPTR-1]); (* CIRCLE *)
END;
END; (* CASE *)
END; (*WITH*)
END;
3: BEGIN (* SINGLE OBJECT *)
WITH DRAWARY[SELNUM] DO
BEGIN
CASE OBJTYP OF
0: BEGIN END; (* DELETED OBJECT *)
1: MODVEC(X1,Y1,STKMAT[STKPTR-1]); (* POINT *)
2: BEGIN (* LINE *)
MODVEC(X1,Y1,STKMAT[STKPTR-1]);
MODVEC(X2,Y2,STKMAT[STKPTR-1]);
END;
3: BEGIN (* BOX *)
MODVEC(X1,Y1,STKMAT[STKPTR-1]);
MODVEC(X2,Y2,STKMAT[STKPTR-1]);
MODVEC(X3,Y3,STKMAT[STKPTR-1]);
END;
4: BEGIN
MODVEC(X1,Y1,STKMAT[STKPTR-1]); (* CIRCLE *)
END;
END; (* CASE *)
END; (*WITH*)
END;
END; (* CASE *)
POPMAT(KODE);
M1 := 2;
MOUSE(M1,M2,M3,M4); (* HIDE MOUSE *)
REDRAW;
M1 := 1; (* SHOW MOUSE *)
MOUSE(M1,M2,M3,M4);
END; (*PROC*)